<?php

namespace Gds\ArticleBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Unite
 *
 * @ORM\Table()
 * @ORM\Entity
 */
class Unite
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="libelle", type="string", length=255)
     */
    private $libelle;
    /**
     * @var integer
     *
     * @ORM\Column(name="chiffre_virgule", type="integer")
     */
    private $chiffre_virgule;

    /**
     * @var string
     *
     * @ORM\Column(name="code", type="string", length=255)
     */
    private $code;
        /**
     * @var boolean $is_supprimer
     *
     * @ORM\Column(name="is_supprimer", type="boolean")
     */
    private $is_supprimer;
/**
     * @ORM\OneToMany(targetEntity="Gds\ArticleBundle\Entity\Article", mappedBy="unite")
     */
    private $articles;
public function __toString() {
    if($this->getCode() == $this->getLibelle())
        return $this->getCode();
    return $this->getCode().'  ('.$this->getLibelle().')';
}
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set libelle
     *
     * @param string $libelle
     * @return Unite
     */
    public function setLibelle($libelle)
    {
        $this->libelle = $libelle;

        return $this;
    }

    /**
     * Get libelle
     *
     * @return string 
     */
    public function getLibelle()
    {
        return $this->libelle;
    }

    /**
     * Set code
     *
     * @param string $code
     * @return Unite
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

    /**
     * Get code
     *
     * @return string 
     */
    public function getCode()
    {
        return $this->code;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->articles = new \Doctrine\Common\Collections\ArrayCollection();
        $this->is_supprimer = false;
    }

    /**
     * Add articles
     *
     * @param \Gds\ArticleBundle\Entity\Article $articles
     * @return Unite
     */
    public function addArticle(\Gds\ArticleBundle\Entity\Article $articles)
    {
        $this->articles[] = $articles;

        return $this;
    }

    /**
     * Remove articles
     *
     * @param \Gds\ArticleBundle\Entity\Article $articles
     */
    public function removeArticle(\Gds\ArticleBundle\Entity\Article $articles)
    {
        $this->articles->removeElement($articles);
    }

    /**
     * Get articles
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getArticles()
    {
        return $this->articles;
    }

    /**
     * Set chiffre_virgule
     *
     * @param integer $chiffreVirgule
     * @return Unite
     */
    public function setChiffreVirgule($chiffreVirgule)
    {
        $this->chiffre_virgule = $chiffreVirgule;

        return $this;
    }

    /**
     * Get chiffre_virgule
     *
     * @return integer 
     */
    public function getChiffreVirgule()
    {
        return $this->chiffre_virgule;
    }

    /**
     * Set is_supprimer
     *
     * @param boolean $isSupprimer
     * @return Unite
     */
    public function setIsSupprimer($isSupprimer)
    {
        $this->is_supprimer = $isSupprimer;

        return $this;
    }

    /**
     * Get is_supprimer
     *
     * @return boolean 
     */
    public function getIsSupprimer()
    {
        return $this->is_supprimer;
    }
}
